//    Copyright (C) Kherty.  All rights reserved.
using System;
using OpenLS.Core.Serialization;
using OpenLS.Drawing;

namespace OpenLS.Chart
{
    internal class PivotFormat : IOfficeXmlSerializable
    {
        private int _idx;
        private ShapeProperties _spPr;
        private TextBody _txPr;
        private Marker _marker;
        private DataLabel _dLbl;
        private ExtensionList _extLst;

        public void ReadXml(ReadContext context)
        {
            using (var c = context.Read("pivotFmt"))
            {
                _idx = c.ReadElementIntegerAttribute("idx");
                _spPr = c.ReadOptionalElement<ShapeProperties>("spPr");
                _txPr = c.ReadOptionalElementAs<TextBody>("txPr");
                _marker = c.ReadOptionalElement<Marker>("marker");
                _dLbl = c.ReadOptionalElement<DataLabel>("dLbl");
                _extLst = c.ReadOptionalElement<ExtensionList>("extLst");
            }

        }

        public void WriteXml(WriteContext context)
        {
            using (var c = context.Write("pivotFmt"))
            {
                c.WriteElementIntegerAttribute("idx", _idx);
                c.WriteOptionalElement(_spPr);
                c.WriteOptionalElementAs(_txPr, "txPr");
                c.WriteOptionalElement(_marker);
                c.WriteOptionalElement(_dLbl);
                c.WriteOptionalElement(_extLst);
            }
        }
    }
}